<style>
.api-book-box {
  border: 1px solid #e1e1e1;
  background-color: #fff;
  height: 190px;
  margin: 31px 27px 0 0;
  float: left;
  overflow: hidden;
  position: relative;

  width: 340px;
}
.api-book-box h2 {
  font-size: 18px;
  line-height: 18px;
  font-weight: 400;
  color: #555;
  text-align: center;
  padding-top: 14px;
}
.api-descrpit {
  padding: 10px 18px 0;
  font-size: 14px;
  line-height: 18px;
  font-weight: 400;
  color: #aaa;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.api-price {
  text-align: center;
  font-size: 14px;
  position: absolute;
  bottom: 38px;
  width: 100%;
  margin: 0 auto;
}
.api-router {
  font-size: 14px;
  font-weight: 400;
  color: #4d90fd;
  text-align: center;
  float: right;
  cursor: pointer;
  width: 50%;
}

.api-function {
  text-align: center;
  font-size: 14px;
  font-weight: 400;
  float: left;
  color: #4d90fd;
  cursor: pointer;
  width: 50%;
}
.clear-both::after {
  content: "";
  display: block;
  clear: both;
}
.under-box {
  width: 100%;
  position: absolute;
  bottom: 0;
}
.under-box::after {
  content: "";
  display: block;
  clear: both;
}
</style>
<template>
  <div class="clear-both">
    <div v-for="(item,index) in data" class="api-book-box">
      <h2>{{ item.name }}</h2>
      <h2>{{ item.title }}</h2>
      <div class="api-descrpit">{{ item.descript }}</div>
      <div class="api-price">{{ item.price }}元/次</div>
      <div class="under-box">
        <div class="api-function" @click="toApifuncition(item.name)">api功能演示</div>
        <div class="api-router" @click="toDetail(item.name)">api文档</div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: "APIIndex",
  props: {
    data: {
      type: Array,
      required: true
    }
  },
  data() {
    return {};
  },
  methods: {
    toDetail(name) {
      this.$emit("toRouter", name);
    },
    toApifuncition(name){
      this.$emit("toApifun",name)
    }
  }
};
</script>
